import logo from './logo.svg';
import { BrowserRouter as Router, Route, Switch, Routes, useLocation } from 'react-router-dom';
import './App.css';
import BookList from './components/BookList';
import Register from './pages/register';
import Home from './pages/home';
import Index from './pages/index';
import LayoutBlock from './layout/index';

function App() {

  const location = useLocation();
  const isAuthRoute = location.pathname === '/register';

  return (
    <Routes>
      {isAuthRoute ? (
        <Route path="/register" element={<Register />} />
      ) : (
        <Route path="*" element={<LayoutBlock />} />
      )}
    </Routes>
  );
}

export default App;
